package com.tw.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.tw.init.MessageCluster;

public class WebSocketListener implements ServletContextListener {
	
	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		MessageCluster.shutdown();
	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		try {
			String realPath = arg0.getServletContext().getRealPath("");
			MessageCluster.init(realPath+"WEB-INF/webSocket-hazelcast.xml");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
